-- 制造特效
local function Makepowerchangefx(anim)
    local assets = {Asset("ANIM", "anim/obrsword_powerchange_"..anim..".zip")}

    local function fn()
        local inst = CreateEntity()
        inst.entity:AddTransform()
        inst.entity:AddAnimState()
        inst.entity:AddNetwork()
        inst.entity:AddLight()

        inst.Light:Enable(true) -- 开启照明    false为关闭
        inst.Light:SetIntensity(.5) -- 光照强度.99为强光
        inst.Light:SetColour(0.1, 1, 0.1)
        inst.Light:SetFalloff(0.6) -- 最大范围再向外辐射的光效，1几乎不辐射
        inst.Light:SetRadius(2) -- 照明范围
        inst.Light:EnableClientModulation(false)

        inst.AnimState:SetBank("obrsword_powerchange_" ..anim)
        inst.AnimState:SetBuild("obrsword_powerchange_" ..anim)
        inst.AnimState:PlayAnimation(anim)
        inst.AnimState:SetScale(1, 1)

        inst:AddTag("FX")

        inst.entity:SetPristine()

        if not TheWorld.ismastersim then
            return inst
        end

        inst:DoTaskInTime(1.5, function()
            -- inst.AnimState:PlayAnimation("disapear")
            inst:DoTaskInTime(.01, inst.Remove)
        end)

        return inst
    end
    return Prefab("obrsword_powerchange_" .. anim, fn, assets)
end

return Makepowerchangefx("normal"), Makepowerchangefx("knife"), Makepowerchangefx("water"), Makepowerchangefx("fire"),
    Makepowerchangefx("wind"), Makepowerchangefx("dirt"),Makepowerchangefx("firesign")
